<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <script src="./vue.js"></script>
</head>
<body>
  <div id="app">
    <input type="text" ref="search">
    <button @click="click">按钮</button>
  </div>
  <script>
    const app = new Vue({
      el: '#app',
      data: {

      },
      methods: {
        // 在DOM元素上写上ref="attrValue"
        // 就可以通过this.$refs.attrValue 获取这个原生对象
        click () {
          console.log(this.$refs.search)
          this.$refs.search.focus()
        }
      }
    })
  </script>
</body>
</html>
